<template>
  <div>
    <avue-form ref="ruleForm"
               v-model="ruleForm"
               :disabled="tag == 0 ? 'true' : 'false'"
               :option="option">
    </avue-form>
    <el-collapse v-model="activeNameStart">
      <!-- 初始节点 -->
      <el-collapse-item name="0"
                        v-if="startNodeDto.nodeName">
        <template slot="title">
          <el-col :span="8"
                  class="title">{{ startNodeDto.nodeName }}</el-col>
          <el-col :span="16"
                  style="text-align:right;">
            <span class="spans">
              操作人:{{ startNodeDto.handlerName }}({{
              startNodeDto.handlerId
              }})
            </span>
            <span class="spans">提交时间: {{ startNodeDto.submitTime }}</span>
          </el-col>
        </template>
        <div :class="tag == 0 ? 'historyNode node startNode' : 'node'">
          <node-form :jsonData="startNodeDto.nodeContent"
                     :formvalues='startNodeDto.nodeContent.modelValue'
                     :disabled="tag == 0 ? 'true' : 'false'"
                     @sendmsg="getMsgs"
                     ref="startForm"></node-form>
        </div>
      </el-collapse-item>
      <!-- 外部转入工单携带的信息 -->
      <el-collapse-item v-for="(item, index) in externalFlowInfo"
                        :key="index"
                        :name="index">
        <template slot="title">
          <el-col :span="8"
                  class="title">{{ item.dealFlowNode }}</el-col>
          <el-col :span="16"
                  style="text-align:right;">
            <span class="spans">操作人:{{ item.dealUserName }}({{ item.dealUserId }})</span>
            <span class="spans">提交时间: {{ item.dealTime }}</span>
          </el-col>
        </template>
        <div class="historyNode node">
          <p>处理意见：{{ item.dealOpinion }}</p>
        </div>
      </el-collapse-item>
      <!-- 历史节点 -->
      <el-collapse-item v-for="(item, index) in workOrderNodeDtoList"
                        :key="item.submitTime"
                        :name="index">
        <template slot="title">
          <el-col :span="8"
                  class="title">{{ item.nodeName }}</el-col>
          <el-col :span="16"
                  style="text-align:right;">
            <span class="spans">操作人: {{ item.handlerName }}({{ item.handlerId }})</span>
            <span class="spans">提交时间: {{ item.submitTime }}</span>
          </el-col>
        </template>
        <div v-if="item.nodeContent.config"
             :class="tag == 0 ? 'historyNode node processNode' : 'node'">
          <node-form :jsonData="item.nodeContent"
                     :formvalues='item.nodeContent.modelValue'
                     :disabled="tag == 0 ? 'true' : 'false'"
                     @sendmsg="getMsg"></node-form>
        </div>
        <!-- 展示投管回来的信息 -->
        <div v-else
             class="node tsBusinessInfo">
          <ul>
            <li v-for="(itemInfo, index) in item.nodeContent.list"
                :key="index"
                class="tsLi">
              <el-row :gutter="20">
                <el-col :span="8">处理人：{{ itemInfo.Performer }}</el-col>
                <el-col :span="10">处理时间：{{ itemInfo.ActionTime }}</el-col>
                <el-col :span="6">处理环节：{{ itemInfo.StepName }}</el-col>
              </el-row>
              <p class="problemDesc">处理意见：{{ itemInfo.Action }}</p>
              <ul v-if="itemInfo.fileList">
                <span>附件：</span>
                <li v-for="(fileList, listIndex) in itemInfo.fileList"
                    :key="listIndex"
                    style="margin-left:30px;color:#606266;font-size:14px;">
                  <a :href="fileList.url"
                     target="_blank"> {{fileList.name}}
                  </a>
                </li>
              </ul>
            </li>
          </ul>
        </div>
      </el-collapse-item>
      <!-- 当前节点 -->
      <el-collapse-item name="now"
                        v-if="!(ruleFormInfo.contrOptionTag == 2||ruleFormInfo.contrOptionTag == 0) && nodeName">
        <template slot="title">
          <el-col :span="8"
                  class="title">{{ ruleFormInfo.currentNodeDto.nodeName }}</el-col>
        </template>
        <div class="node"
             style="padding-bottom:30px;">
          <node-form v-if="jsonDatas"
                     :jsonData="jsonDatas"
                     :formvalues='currentFormValues'
                     @sendmsg="getMsg"
                     ref="mychild"
                     @getChangeData="getChangeData"></node-form>
        </div>
      </el-collapse-item>
      <!-- 正泰集团定制    定向给跟进人展示工单待检查的保存下流转信息 -->
      <!-- <el-collapse-item name="now"
                        v-if="!(ruleFormInfo.contrOptionTag == 2 ||ruleFormInfo.contrOptionTag == 1) &&
        ruleFormInfo.businessHandlerId ==$store.state.userId && ruleFormInfo.statusName =='工单待检查'">
        <template slot="title">
          <el-col :span="8"
                  class="title">{{ ruleFormInfo.currentNodeDto.nodeName }}</el-col>
        </template>
        <div class="historyNode node"
             style="padding-bottom:30px;">
          <node-form v-if="jsonDatas"
                     :jsonData="jsonDatas"
                     @sendmsg="getMsg"
                     ref="mychild"
                     @getChangeData="getChangeData"></node-form>
        </div>
      </el-collapse-item> -->
    </el-collapse>
    <!-- 已拨打未完成---只留保存| 无需拨打---留结案 -->
    <el-divider></el-divider>
    <el-row class="button-fixed">
      <div>
        <el-button @click="getCurrentOrder"
                   type="button"
                   v-if="ruleFormInfo.distributionWay && ruleFormInfo.contrOptionTag != 2"
                   class="el-button el-button--primary el-button--medium h30Btn  fr">领取</el-button>
      </div>
      <div v-if="isFlowButtonShowValue == true">
        <el-button class="el-button el-button--primary el-button--medium h30Btn "
                   type="primary"
                   v-show="startNodeDto.nodeName && iswithdraw == 'Y' && btnStates.EWS_order_revocation_024 && ruleFormInfo.contrOptionTag != 2 "
                   @click="changeRevocation">撤回</el-button>
        <!-- 驳回按钮：非初始节点和关闭状态的 -->
        <el-button class="el-button el-button--primary el-button--medium h30Btn"
                   type="primary"
                   v-if="(btnStates.EWS_reject_038 && ruleFormInfo.contrOptionTag == 1) && ruleFormInfo.rejectedSign ==='Y'"
                   @click="changeReject">驳回</el-button>
        <!-- 0不能处理 1正常  2工单已关闭状态-->
        <el-button v-for="item in sequenceFlows"
                   class="el-button el-button--primary el-button--medium h30Btn "
                   v-show="!(ruleFormInfo.contrOptionTag == 2 || ruleFormInfo.contrOptionTag == 0)"
                   :key="item.id"
                   type="primary "
                   @click="changeFlows(item)">{{ item.name }}</el-button>
      </div>
    </el-row>
    <!--转派弹框-->
    <redeploy-dialog v-show="redeployShow"
                     v-if='forms.nodes != []'
                     :formNodes='forms.nodes'
                     :ruleFormInfo="ruleFormInfo"
                     @redeployShow="redeployShowFun"
                     @cancelredeployShow='cancelredeployShowFun'></redeploy-dialog>
    <!-- 改派弹窗 -->
    <order-transfer v-show="reassignShow"
                    v-if="orderTransferInfo"
                    @transferShow="transferShowFun"
                    :orderTransferInfo="orderTransferInfo"
                    :processInstanceId="ruleFormInfo.processInstanceId"
                    :ruleFormInfo="ruleFormInfo"
                    :opration='opration'></order-transfer>
    <!-- 邮件弹窗 -->
    <mail-dialog v-if="mailShow"
                 @mailShow="mailShowFn"
                 :descContent="emailInfoData"></mail-dialog>
    <!-- 短信弹窗 -->
    <note-dialog v-if="noteShow"
                 @noteShow="noteShowFn"
                 :descContent="msgInfoData"
                 :phoneNum="itemType == '3'?ruleForm.call_number:ruleForm.phone_number"></note-dialog>
    <!-- 电话弹窗 -->
    <phone-dialog v-if="phoneShow "
                  @phoneShow="phoneShowFn"
                  :phoneNum="itemType == '3'?ruleForm.call_number:ruleForm.phone_number"></phone-dialog>
    <!-- 调听录音 -->
    <audio-dialog v-show="recordShow"
                  @audioShow="audioShowFn"
                  ref="audioVoice"></audio-dialog>
    <!-- 驳回/撤回弹窗 -->
    <reject-dialog v-show="rejectShow"
                   :title="titleInfo"
                   @changeShow="rejectFun"></reject-dialog>
  </div>
</template>

<script>
import { getChatContent } from '@/api/workOrderController.js'
import { newOption } from "@/common/commonOption.js";
import nodeForm from "@/components/common/nodeForm";
import { getTemplateFromOfStartNode } from '@/api/workOrderTypeNode'
import {
  getWorkOrderTypeByUserId,
  processWorkOrder,
  selectAllType,
  getMsgTemplate,
  workOrderRecieve,
  getSelectableNodes,
  getUserListByWorkOrderTypeNodeId,
  getNodeHandleUserInfoByNodeId
} from "@/api/workOrderController";
import common from "@/common/common.js";
import { SystemField } from "@/common/generalField.js"
import orderTransfer from "@/views/orderDataList/orderDialog/orderTransfer";
import mailDialog from "@/views/orderDataList/orderDialog/mailDialog";
import noteDialog from "@/views/orderDataList/orderDialog/noteDialog";
import phoneDialog from "@/views/orderDataList/orderDialog/phoneDialog";
import redeployDialog from '@/views/orderDataList/orderDialog/redeployDialog'
import rejectDialog from '@/views/orderDataList/orderDialog/rejectDialog'
import {
  getNoticeTemplateType,
} from "@/api/setNotice";
import audioDialog from "@/views/orderDataList/orderDialog/audioDialog";
import { getVoiceInfo } from '@/api/workOrderController';
export default {
  props: ["ruleFormInfo", "isFlowButtonShowValue"],
  inject: ["reload"], // 引入页面同步刷新的依赖
  data () {
    return {
      itemType: window.CONFIG.itemType,
      btnStates: window.CONFIG.btnState,
      orderTransferInfo: '',
      redeployShow: false,
      redeploy: "",//存放转派信息
      sizeValue: "",
      iswithdraw: "N",
      reassignShow: false, // 改派的条件
      voiceDataInfo: {
        voiceKeyId: "", // 录音标识
        createUserId: "" // 创建人id
      },
      activeNameStart: ["0", "now"],
      multimediaType: sessionStorage.getItem("multimediaCall"),
      // 短信和邮件的模板数据
      msgInfoData: [],
      emailInfoData: [],
      type: [],
      classifyList: [],
      formKeySign: '0',
      tag: "",
      startNodeDto: {
        nodeContent: {
          list: [],
          config: {
            labelWidth: 100,
            labelPosition: "top",
            size: "small"
          }
        }
      },
      getStartJsonData: {},
      jsonData: {},
      forms: {
        nodeVal: "",
        nodes: [],
        userType: "",
        userTypes: [],
        userOptions: []
      },
      ruleForm: {
        customField: {}
      },
      ruleFormData: {},
      rules: {
        // 1.工单流程 2.客户姓名 3.联系电话 4.工单分类 5.涉及机构  6.交易渠道 7.工单内容
        type: [
          {
            required: true,
            message: "请输入工单流程",
            trigger: ["blur", "change"]
          }
        ],
        name: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
        region: [
          { required: true, message: "请选择工单流程", trigger: "blur" }
        ],
        orderContent: [
          { required: true, message: "请输入工单内容", trigger: ["blur"] }
        ]
      },
      nodeId: "",
      nodeName: "",
      sequenceFlows: [],
      getJsonData: {},
      opration: {},
      workOrderNodeDtoList: [],
      taskId: "",
      transferShow: false,
      mailShow: false,
      noteShow: false,
      phoneShow: false,
      recordShow: false,
      rejectShow: false,
      isSend: true, // 根据条件判断是否要选择抄送
      jsonDatas: "",
      logList: [],
      externalFlowInfo: "", // 外部转入创建工单携带的信息
      currentFormValues: {
      },
      titleInfo: '',
    };
  },
  components: {
    nodeForm,
    orderTransfer,
    mailDialog,
    noteDialog,
    phoneDialog,
    redeployDialog,
    rejectDialog,
    audioDialog
  },
  created () {
  },
  mounted () {
    this.getWorkOrderTypeByUserIdFun()
  },
  watch: {
    jsonData (n, o) {
      this.jsonDatas = n;
    },
    ruleFormInfo (n, o) {
      Object.assign(this.ruleFormInfo, this.ruleFormInfo.customField);
      this.getProcessMessage();
    }
  },
  computed: {
    classifyShow () {
      return this.ruleForm.workOrderTypeId && this.formKeySign === '1'
    },
    newTagInfo () {
      if (this.tag == 1 && this.ruleFormInfo.contrOptionTag == 1) {
        return false
      } else {
        return true
      }
    },
    option () {
      let valueArray = {
        sizeValue: this.sizeValue,
        type: this.type,
        classifyList: this.classifyList,
        formTag: this.tag,
      };
      let formInfo = this.ruleForm.customField;
      let formFun = {
        changeRegion: '',
        changeProblem: this.changeProblem,
        classifyShow: this.classifyShow
      }
      let newOptionInfo = newOption(valueArray, formInfo, formFun)
      // 服务单类型禁用掉
      for (var i = 0; i < newOptionInfo.column.length; i++) {
        if (newOptionInfo.column[i].prop == 'workOrderTypeId') {
          newOptionInfo.column[i].disabled = true
        }
        if (newOptionInfo.column[i].prop == 'classifyData') {
          newOptionInfo.column[i].disabled = true
        }
      }
      return newOptionInfo
    }
  },
  methods: {
    // 获取文本会话内容
    getChatInfo () {
      let params = {
        tenantId: sessionStorage.getItem('tenantId') || 'default',
        sessionId: this.ruleFormInfo.voiceKeyId || '',
        agentId: this.ruleFormInfo.customField.CREATE_AGENT || ''
      }
      if (params.sessionId && params.agentId) {
        this.chatContentShow = true
        this.$refs.chatInfo.getChatContent(params)
      } else {
        this.$message({
          type: "fail",
          message: "无会话内容!"
        });
      }
    },
    // 获取问题分类
    getTemplateFromOfStartNodeFun () {
      let id = this.ruleForm.workOrderTypeId
      getTemplateFromOfStartNode(id).then(res => {
        if (res.data.retCode === 200) {
          this.classifyList = res.data.data
        }
      })
    },
    // 获取转派的数据
    getData () {
      let _this = this
      let id = this.$store.state.workOrderTypeId // id
      let params = { workOrderTypeId: id, nodeId: this.ruleFormInfo.currentNodeDto.nodeId }
      getSelectableNodes(params).then(res => {
        let data = res.data
        if (data.retCode === 200) {
          _this.forms.nodes = data.data
          for (var i in _this.forms.nodes) {
            // 过滤初始节点
            if (_this.forms.nodes[i].tag == '1') {
              _this.forms.nodes.splice(i, 1)
              // 过滤当前节点
              for (var y in _this.forms.nodes) {
                if (this.ruleFormInfo.currentNodeDto.nodeId == _this.forms.nodes[y].nodeId) {
                  _this.forms.nodes.splice(y, 1)
                }
              }
            }
          }
          console.log(_this.forms.nodes)
        }
      })
    },
    // 领取工单
    getCurrentOrder () {
      // 领取工单的接口
      let params = {
        workOrderId: this.$store.state.orderDetailsId,
        userId: this.$store.state.userId,
        processInstanceId: this.ruleFormInfo.processInstanceId,
        currentWorkOrderNodeId: this.ruleFormInfo.startNodeDto.nodeId,
        workOrderStatusId: this.ruleFormInfo.statusId,
        distributeWay: this.ruleFormInfo.distributionWay || ""
      };
      workOrderRecieve(params).then(res => {
        if (res.data.retCode === 200) {
          this.$message({
            type: "success",
            message: res.data.msg
          });
          this.isFlowButtonShowValue = true;
          this.reload();
        } else {
          this.$message({
            type: "error",
            message: res.data.msg
          });
        }
      });
    },
    // 根据类型节点id查询用户列表
    getUserListByWorkOrderTypeNodeId (id) {
      // this.forms.userOptionsNew = []
      getUserListByWorkOrderTypeNodeId(id).then(res => {
        if (res.data.retCode == 200) {
          this.forms.userOptions = res.data.data;
          // 当是改派的时候过滤当前用户
          res.data.data.forEach(item => {
            if (item.id == this.$store.state.userId) {
              this.forms.userOptions.splice(item, 1)
            }
          })
          this.orderTransferInfo = this.forms.userOptions
        }
      })
    },
    // 时间戳转换时间
    timestampToTime (timestamp) {
      return common.timestampToTime(timestamp);
    },
    // 拼接短信模板
    // getNoteTemplate (name) {
    //   this.infoData.templateData = [];
    //   for (let i = 0; i < this.infoData.list.length; i++) {
    //     let lableInfo = this.infoData.list[i].remark;
    //     let valueIbnfo = this.infoData.list[i].name;
    //     var rgTestUser = /(\{[n][a][m][e]\})/;
    //     var rgTestId = /(\{[o][r][d][e][r][I][d]\})/;
    //     // lableInfo = lableInfo.replace(rgTestUser, " " + name + " ");
    //     // lableInfo = lableInfo.replace(
    //     //   rgTestId,
    //     //   " " + this.$store.state.orderDetailsId + " "
    //     // );
    //     this.infoData.templateData.push({
    //       value: valueIbnfo,
    //       label: lableInfo
    //     });
    //   }
    // },
    // 获取短信模板
    getMsgTemplate () {
      getNoticeTemplateType('msg').then(res => {
        if (res.data.retCode === 200) {
          this.msgInfoData = res.data.data
        }
      })
    },
    getEmailTemplate () {
      getNoticeTemplateType('email').then(res => {
        if (res.data.retCode === 200) {
          this.emailInfoData = res.data.data
        }
      })
    },
    async getProcessMessage () {
      // 0为表单不可编辑状态  1为可编辑状态
      let _this = this
      this.ruleForm = this.ruleFormInfo;
      Object.assign(_this.ruleForm, _this.ruleForm.customField);
      _this.formKeySign = _this.ruleFormInfo.formKeySign
      if (_this.ruleFormInfo.formKeySign === '1') {
        await _this.getTemplateFromOfStartNodeFun()
      }
      _this.tag = _this.ruleFormInfo.alterFormTag;
      _this.iswithdraw = _this.ruleFormInfo.iswithdraw;
      _this.voiceDataInfo.voiceKeyId = _this.ruleFormInfo.voiceKeyId; // 录音id
      _this.voiceDataInfo.createUserId = _this.ruleFormInfo.createUserId; // 创建人id
      _this.nodeId = _this.ruleFormInfo.currentNodeDto.nodeId;
      _this.nodeName = _this.ruleFormInfo.currentNodeDto.nodeName;
      _this.jsonData = _this.ruleFormInfo.currentNodeDto.formTemplate;
      _this.sequenceFlows = _this.ruleFormInfo.currentNodeDto.sequenceFlows;
      _this.currentFormValues = Object.assign(SystemField({}), this.jsonData.modelValue)
      _this.ruleFormInfo.processedWorkOrderNodeDtoList.forEach((val, index) => {
        // 苏农默认全部展开
        if (window.CONFIG.itemType === '3') {
          _this.activeNameStart.push(index)
        }
        if (val.nodeContent.config) {
          _this.setDisabledFun(val.nodeContent)
        }
      });
      _this.workOrderNodeDtoList = _this.ruleFormInfo.processedWorkOrderNodeDtoList;
      _this.startNodeDto = _this.ruleFormInfo.startNodeDto;
      if (_this.ruleFormInfo.externalFlowInfo) {
        _this.externalFlowInfo = _this.ruleFormInfo.externalFlowInfo.externalFlowInfo; // 外部创建转入工单带入的信息
      }
      // 初始节点禁止修改的展示
      if (!(_this.tag == 1 && _this.ruleFormInfo.contrOptionTag == 1)) {
        if (_this.startNodeDto.nodeName) {
          _this.setDisabledFun(_this.ruleFormInfo.startNodeDto.nodeContent)
        }
      }
      _this.taskId = _this.ruleFormInfo.currentNodeDto.taskId;
    },
    setDisabledFun (dataList) {
      let _this = this
      dataList.list.forEach(x => {
        if (x.type !== 'imgupload') {
          x.options.disabled = true;
          setTimeout(() => {
            let proUploadList = document.querySelectorAll('.startNode .el-upload--picture-card')
            for (var k = 0; k < proUploadList.length; k++) {
              proUploadList[k].style.display = 'none'
            }
          }, 100);
        }
        if (x.columns) {
          x.columns.forEach(y => {
            _this.setDisabledFun(y)
          })
        }
      })
    },
    getSelectAllType () {
      selectAllType().then(res => {
        if (res.data.retCode === 200) {
          this.forms.userTypes = res.data.data;
        }
      });
    },
    cancelTransfer () {
      this.transferShow = false;
    },
    // 点击右下方配置按钮判断类型类型
    changeFlows (val) {
      this.opration = val;
      if (val.type === "zhuanpai") {
        this.redeployShow = true;
        this.getSelectAllType();
        this.getData()
      } else if (val.type === "mail") {
        this.mailShow = true;
        this.getEmailTemplate();
      } else if (val.type === "note") {
        this.noteShow = true;
        this.getMsgTemplate();
      } else if (val.type === "phone") {
        this.phoneShow = true;
      } else if (val.type === "record") {
        this.recordShow = true;
        this.playAudio()
      } else if (val.type === "copy") {
        this.$emit("hadleFormdetails", '新建');
        // this.$router.push("./createForm");
      } else if (val.type === "gaipai") {
        this.getSelectAllType();
        this.changetransferShow()
        this.reassignShow = true;
      } else {
        this.submitForm("ruleForm");
      }
    },
    //   撤回弹窗
    changeRevocation () {
      this.titleInfo = "撤回"
      this.rejectShow = true
    },
    // 关闭转派弹框
    cancelredeployShowFun (e) {
      this.redeployShow = e
    },
    // 关闭转派弹框
    redeployShowFun (val) {
      this.redeployShow = val.redeployShow
      this.redeploy = val
      this.submitForm("ruleForm");
    },
    // 改派弹框
    changetransferShow () {
      this.reassignShow = true;
      getNodeHandleUserInfoByNodeId(this.nodeId).then(res => {
        if (res.data.retCode == 200) {
          this.orderTransferInfo = res.data.data
        }
      })
      // this.getUserListByWorkOrderTypeNodeId(
      //   this.ruleFormInfo.currentNodeDto.nodeId
      // );
    },
    // 关闭改派弹框
    transferShowFun (e) {
      if (e) {
        this.reload()
      }
      this.reassignShow = false;
    },
    // 关闭邮件弹窗
    mailShowFn (e) {
      this.mailShow = e;
    },
    // 关闭短信弹窗
    noteShowFn (e) {
      this.noteShow = e;
    },
    // 关闭电话弹窗
    phoneShowFn (e) {
      this.phoneShow = e;
    },
    // 关闭录音弹窗
    audioShowFn (e) {
      this.recordShow = e;
    },
    // 播放录音文件
    playAudio () {
      if (this.voiceDataInfo.voiceKeyId && this.voiceDataInfo.voiceKeyId !== '') {
        let params = {
          callUUID: this.voiceDataInfo.voiceKeyId
        }
        this.$refs.audioVoice.getVoiceInfo(params)
      } else {
        this.$message({
          type: "fail",
          message: "无语音文件!"
        });
      }


    },
    changeReject () {
      this.titleInfo = "驳回"
      this.rejectShow = true
    },
    rejectFun (e) {
      this.rejectShow = e.value
      if (e.name === 'submit') {
        this.$emit("removeTab", "");
      }
    },
    getMsg (data) {
      this.getJsonData = data;
    },
    // 初始节点获取表单数据
    getMsgs (data) {
      this.getStartJsonData = data;
    },
    getWorkOrderTypeByUserIdFun () {
      let id = 'all'
      getWorkOrderTypeByUserId(id).then(res => {
        let data = res.data;
        if (data.retCode === 200) {
          this.type = data.data; // 工单流程
        }
      });
    },
    async submitForm (formName) {
      let _this = this
      if (this.$refs.mychild) {
        if (!await this.$refs.mychild.change()) {
          return
        }
      }
      if (_this.$refs.startForm) {
        if (!await this.$refs.startForm.change()) {
          return
        }
      }
      if (_this.getStartJsonData && _this.getStartJsonData.modelValue) {
        _this.getStartJsonData.content.modelValue = _this.getStartJsonData.modelValue
      }
      if (_this.getJsonData && _this.getJsonData.modelValue) {
        _this.getJsonData.content.modelValue = _this.getJsonData.modelValue
      }
      let params = {
        customIdentify: this.ruleForm.phone || "",
        userId: this.$store.state.userId, // 坐席
        workOrderTypeId: this.ruleForm.workOrderTypeId || "", // 工单流程
        classifyValue: this.ruleForm.classifyValue || '', // 问题分类
        workOrderId: this.$store.state.orderDetailsId, // 工单号
        tag: this.tag,
        startFormInputDto: {
          content: this.getStartJsonData.content,
          modelValue: this.getStartJsonData.modelValue,
          nodeId: this.startNodeDto.nodeId,
          nodeName: this.startNodeDto.nodeName,
          taskId: this.startNodeDto.taskId
        },
        writeFormTemplateInputDto: {
          content: this.getJsonData.content,
          modelValue: this.getJsonData.modelValue,
          nodeId: this.nodeId,
          nodeName: this.nodeName,
          taskId: this.taskId
        },
        opration: this.opration,
        // 转派组装的数据
        redeploy: {
          roleType: this.redeploy.roleType || '',
          targetNodeId: this.redeploy.targetNodeId || '',
          value: this.redeploy.value || []
        }
      };
      params.customField = this.ruleForm.customField;
      await this.$refs[formName].validate(valid => {
        if (valid) {
          if (this.opration.type === "zhuanpai") {
            processWorkOrder(params).then(res => {
              if (res.data.retCode === 200) {
                this.$message({
                  message: res.data.msg,
                  type: "success"
                })
                // this.$router.push(
                //   "/orderTable/" + this.$store.state.orderTypeId
                // );
                this.$emit("removeTab", params.workOrderId);
              }
            });
          } else {
            processWorkOrder(params).then(res => {
              if (res.data.retCode === 200) {
                this.$message({
                  message: res.data.msg,
                  type: "success"
                });
                // this.$router.push(
                //   "/orderTable/" + this.$store.state.orderTypeId
                // );
                this.$emit("removeTab", params.workOrderId);
              }
            });
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    }
  }
};
</script>
<style scoped>
.node {
  padding: 10px 20px;
  background: #f8f9fd;
}

.historyNode select {
  pointer-events: none;
}

>>> .el-upload-list li {
  pointer-events: auto !important;
}

.title {
  font-size: 13px;
  font-weight: bold;
}

/* .center {
  text-align: center;
  font-size: 13px;
} */

/* .confirm {
  padding: 0px 40px !important;
  height: 40px;
  line-height: 40px;
} */

.paging-foot {
  padding: 10px 0;
}

.el-divider--horizontal {
  margin: 20px 0;
}

.button-fixed {
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0%;
  z-index: 99;
  background: #fff;
  padding: 15px;
  display: flex;
  justify-content: flex-end;
}

>>> .el-form-item__label {
  white-space: nowrap;
}

>>> .historyNode .el-upload .el-button--primary {
  background-color: gray;
}

>>> .is-active {
  color: #231815;
}

.item_log .el-badge__content {
  margin-top: 20px;
}

.tsBusinessInfo ul .tsLi:not(:last-child) {
  padding-bottom: 10px;
  border-bottom: 1px solid #ebeef5;
}
/deep/.avue-form__menu {
  display: none;
}
/* .noHoldNodeBtns {
  display: none;
} */
/* .classifyData {
  display: flex;
  margin-left: -70px;
} */
>>> .el-input__inner,
>>> .el-textarea__inner {
  color: #606266 !important;
}
</style>
